<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <h2>handle.apply()方法用于拦截函数调用</h2>
    <script>
        function sum(a, b) {
            return a + b;
        }

        const handler = {
            apply: function (target, thisArg, argumentsList) {
                debugger;
                console.log( argumentsList)
                var join = 0;
                // return target(argumentsList[0], argumentsList[1]) * 10;
                for (let i in argumentsList) {
                    join += argumentsList[i] *3
                }
                return join;
            }
        }

        const proxy1 = new Proxy(sum, handler)

        console.log(sum(1, 2))
        console.log(proxy1(1, 2))
    </script>
</body>

</html>